package controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/*
 * 控制器的类
 *
 *  */
public class FirstController implements Controller {


    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
//        创建ModelAndView现象
        ModelAndView modelAndView = new ModelAndView();
//        向模型对象添加数据。
        modelAndView.addObject("mav", "hello world");
//        设置视图名
        modelAndView.setViewName("/WEB-INF/hello.jsp");
        return modelAndView;
    }
}






























